package easytalk.views;

import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;

import common.Locutor;

class ViewLabelProvider extends LabelProvider implements ITableLabelProvider {

	public Image getColumnImage(Object obj, int index) {
		Locutor locutor = (Locutor) obj;

		if (index == 0) {
			return locutor.getImage();
		}

		return null;
	}

	public String getColumnText(Object obj, int index) {

		Locutor locutor = (Locutor) obj;

		switch (index) {
		case 0:

			return null;
		case 1:
			return locutor.getName() + Messages.getString("ViewLabelProvider.0") + locutor.getId(); //$NON-NLS-1$
		case 2:

			return locutor.getStatus().toString() + Messages.getString("ViewLabelProvider.1") //$NON-NLS-1$
					+ locutor.getStatus().getAvailability();
		default:
			return null;
		}

	}

	public Image getImage(Object obj) {
		return PlatformUI.getWorkbench().getSharedImages().getImage(
				ISharedImages.IMG_OBJ_ELEMENT);
	}

}